home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8149 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  4.5 KB

  1. Path: goanna.cs.rmit.EDU.AU!not-for-mail
  2. From: ok@goanna.cs.rmit.EDU.AU (Richard A. O'Keefe)
  3. Newsgroups: comp.lang.ada,comp.lang.c++,comp.lang.c,comp.lang.modula3,comp.lang.modula2
  4. Subject: Integer coding (was Re: Hungarian notation - whoops!)
  5. Date: 15 Feb 1996 15:24:20 +1100
  6. Organization: Comp Sci, RMIT, Melbourne, Australia
  7. Message-ID: <4fuchk$phu@goanna.cs.rmit.EDU.AU>
  8. References: <30C40F77.53B5@swsbbs.com> <Pine.HPP.3.91.960124153551.24374C-100000@zeezrom.cs.byu.edu> <4e7ifl$et3@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960129133429.8419C-100000@foggy.cs.byu.edu> <4em29qINN39r@keats.ugrad.cs.ubc.ca> <Pine.HPP.3.91.960201015336.17360C-100000@clear.cs.byu.edu> <4f41vf$g8j@goanna.cs.rmit.EDU.AU> <Pine.HPP.3.91.960205124102.18647E-100000@warm.cs.byu.edu> <4fc157$jsf@goanna.cs.rmit.EDU.AU> <1996Feb8.130010.27570@friend.kastle.com> <dewar.824060370@schonberg>
  9. NNTP-Posting-Host: goanna.cs.rmit.edu.au
  10. X-Newsreader: NN version 6.5.0 #0 (NOV)
  11.  
  12. dewar@cs.nyu.edu (Robert Dewar) writes:
  13.  
  14. >Incidentally, I asked for verification of the surprising claim that there
  15. >is a currently manufactured mainframe that uses sign+magnitude representation
  16. >for integers. No one has verified this, and I think the claim is bogus,
  17. >probably based on confusion with fpt, or some other confusion.
  18.  
  19. But I *did* respond.  According to postings in comp.arch, the architectural
  20. line begun by the Burroughs B6500 is still alive and well.  I don't know what
  21. the current model is, is it the A19?  Something like that.
  22.  
  23. >I would be delighted if someone would prove me wrong on this, it would be
  24. >a nice example of ancient, and clearly inferior, technology, surviving.
  25.  
  26. It is not at all "clear" that the technology is inferior.
  27. Representational adequacy: in Ada terms
  28.     type B6700_Short_Integer is -(2**39-1) .. (2**39-1);
  29.     type B6700_Long_Integer  is -(2**78-1) .. (2**78-1);
  30.     type B6700_Short_Float   is digits 11;
  31.     type B6700_Long_Float    is digits 23;
  32. What it provided was perfectly adequate for Fortran (I have noticed nothing
  33. in the Fortran 90 standard that it couldn't handle), Pascal (again, I have
  34. noticed nothing in the ISO Pascal Extended standard that it couldn't handle),
  35. Algol, PL/I (as it stood at the time; IBM PL/I for OS/2 has unsigned), Lisp
  36. (yes, there was a Lisp), Simula, and SNOBOL (the SNOBOL system was actually
  37. the standard SIL implementation of SNOBOL macro-expanded by the Algol
  38. compiler to Algol).
  39.  
  40. By the way, you don't need unsigned arithmetic to do bit twiddling.
  41. The machine had the usual set of bit-wise operations plus bitfield extraction
  42. and insertion.
  43.  
  44. It should be "clear" that sign and magnitude representation for integers is
  45. if anything better for multiplication and division (assuming the Algol 60
  46. definition for div and mod, and I know that's not always best) and should
  47. be the same for comparison.  It should also be "clear" that converting
  48. between 2s complement and sign-and-magnitude representation can be done as
  49. fast as an add or faster, so an add or subtract could be at most three times
  50. slower than a 2s complement add or subtract.  A little thought improves the
  51. bound to two times slower.  I am not skilled at computer architecture, but
  52. it seems "clear" to me that a single-cycle sign-and-magnitude add/subtract is
  53. acheivable with something between 100% and 200% of the area of a 2s-complement
  54. one, and I reckon it's closer to the 100% end.
  55.  
  56. Let's put this in perspective.  From last year's ASPLOS:
  57.     CPU speeds increase by 40% a year
  58.     but main memory speeds have improved by only a factor of 10
  59.     over the last decade, while processor speeds are up by 100
  60.     Primary cache miss penalties are around 20 cycles,
  61.     but are soon expected to be around 100.
  62.  
  63.     A floating-point add can be done in 2 cycles.
  64.     A 3 cycle unit saves a fair bit of area.
  65.  
  66. If a floating-point add, which requires alignment and normalisation, can
  67. be done in 2 cycles, surely an integer sign-and-magnitude add can be done
  68. in 1 cycle, and in any case, that's not the main bottleneck any more.
  69.  
  70. What *really* counts in today's technology is trying to cope with the gap
  71. between processor speeds and memory speeds.  The representation of integers
  72. has no effect that I can see on that, and should have no effect on overall
  73. system performance.  Apparently the current A series machines are quite
  74. adequate for financial transaction processing.
  75.  
  76. If a computing technology is to count as "clearly inferior" because it doesn't
  77. easily support C, then heaven help us.
  78. -- 
  79. Election time; but how to get Labour _out_ without letting Liberal _in_?
  80. Richard A. O'Keefe; http://www.cs.rmit.edu.au/~ok; RMIT Comp.Sci.
  81.